Optimal. Leaf size=93 \[ \frac{2 a^2 (A-i B)}{c f (\tan (e+f x)+i)}+\frac{a^2 (3 B+i A) \log (\cos (e+f x))}{c f}-\frac{a^2 x (A-3 i B)}{c}-\frac{i a^2 B \tan (e+f x)}{c f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.155555, antiderivative size = 93, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 2, integrand size = 41, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.049, Rules used = {3588, 77} \[ \frac{2 a^2 (A-i B)}{c f (\tan (e+f x)+i)}+\frac{a^2 (3 B+i A) \log (\cos (e+f x))}{c f}-\frac{a^2 x (A-3 i B)}{c}-\frac{i a^2 B \tan (e+f x)}{c f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3588
Rule 77
Rubi steps
\begin{align*} \int \frac{(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{c-i c \tan (e+f x)} \, dx &=\frac{(a c) \operatorname{Subst}\left (\int \frac{(a+i a x) (A+B x)}{(c-i c x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac{(a c) \operatorname{Subst}\left (\int \left (-\frac{i a B}{c^2}-\frac{2 a (A-i B)}{c^2 (i+x)^2}-\frac{i a (A-3 i B)}{c^2 (i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{a^2 (A-3 i B) x}{c}+\frac{a^2 (i A+3 B) \log (\cos (e+f x))}{c f}-\frac{i a^2 B \tan (e+f x)}{c f}+\frac{2 a^2 (A-i B)}{c f (i+\tan (e+f x))}\\ \end{align*}
Mathematica [B] time = 5.07876, size = 418, normalized size = 4.49 \[ \frac{a^2 \sec (e) (\sin (e+f x)-i \cos (e+f x))^2 (A+B \tan (e+f x)) \left (2 f x (A-3 i B) \cos ^3(e) \cos (e+f x)+\cos (e) \cos (e+f x) \left (-i \cos (2 e) \left (6 B f x+(A-3 i B) \log \left (\cos ^2(e+f x)\right )\right )+2 (B+i A) \cos (2 f x)-2 A f x \sin ^2(e)+A f x-2 A \sin (2 f x)+18 i B f x \sin ^2(e)-6 B f x \sin (2 e)+2 i B \sin (2 f x)\right )-2 i \sin (e) \cos ^2(e) \cos (e+f x) \left ((-3 B-i A) \log \left (\cos ^2(e+f x)\right )+f x (5 A-9 i B)\right )-2 (A-3 i B) \cos (e) (\cos (2 e)-i \sin (2 e)) \cos (e+f x) \tan ^{-1}(\tan (3 e+f x))+A f x \cos (3 e) \cos (e+f x)+2 i A f x \sin ^3(e) \cos (e+f x)+2 i A f x \sin (e) \cos (2 e) \cos (e+f x)+2 B \sin (2 e) \sin (f x)+6 B f x \sin ^3(e) \cos (e+f x)+6 B f x \sin (e) \cos (2 e) \cos (e+f x)-6 i B f x \sin (e) \sin (2 e) \cos (e+f x)+2 i B \cos (2 e) \sin (f x)\right )}{2 c f (\cos (f x)+i \sin (f x))^2 (A \cos (e+f x)+B \sin (e+f x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.04, size = 113, normalized size = 1.2 \begin{align*}{\frac{-i{a}^{2}B\tan \left ( fx+e \right ) }{cf}}-{\frac{2\,iB{a}^{2}}{cf \left ( \tan \left ( fx+e \right ) +i \right ) }}+2\,{\frac{{a}^{2}A}{cf \left ( \tan \left ( fx+e \right ) +i \right ) }}-{\frac{iA{a}^{2}\ln \left ( \tan \left ( fx+e \right ) +i \right ) }{cf}}-3\,{\frac{{a}^{2}B\ln \left ( \tan \left ( fx+e \right ) +i \right ) }{cf}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.47812, size = 275, normalized size = 2.96 \begin{align*} \frac{{\left (-i \, A - B\right )} a^{2} e^{\left (4 i \, f x + 4 i \, e\right )} +{\left (-i \, A - B\right )} a^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 2 \, B a^{2} +{\left ({\left (i \, A + 3 \, B\right )} a^{2} e^{\left (2 i \, f x + 2 i \, e\right )} +{\left (i \, A + 3 \, B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{c f e^{\left (2 i \, f x + 2 i \, e\right )} + c f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 1.77546, size = 144, normalized size = 1.55 \begin{align*} \frac{2 B a^{2} e^{- 2 i e}}{c f \left (e^{2 i f x} + e^{- 2 i e}\right )} + \frac{a^{2} \left (i A + 3 B\right ) \log{\left (e^{2 i f x} + e^{- 2 i e} \right )}}{c f} + \frac{\begin{cases} - \frac{i A a^{2} e^{2 i e} e^{2 i f x}}{f} - \frac{B a^{2} e^{2 i e} e^{2 i f x}}{f} & \text{for}\: f \neq 0 \\x \left (2 A a^{2} e^{2 i e} - 2 i B a^{2} e^{2 i e}\right ) & \text{otherwise} \end{cases}}{c} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.44234, size = 385, normalized size = 4.14 \begin{align*} \frac{\frac{2 \,{\left (-i \, A a^{2} - 3 \, B a^{2}\right )} \log \left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i\right )}{c} + \frac{{\left (i \, A a^{2} + 3 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1 \right |}\right )}{c} - \frac{{\left (-i \, A a^{2} - 3 \, B a^{2}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 1 \right |}\right )}{c} - \frac{i \, A a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} + 3 \, B a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 2 i \, B a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - i \, A a^{2} - 3 \, B a^{2}}{{\left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 1\right )} c} - \frac{-3 i \, A a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 9 \, B a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} + 10 \, A a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 22 i \, B a^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 3 i \, A a^{2} + 9 \, B a^{2}}{c{\left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + i\right )}^{2}}}{f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]